#!/usr/bin/python
#########################################################################
# Author: Kai Ren
# Created Time: 2012-02-14 04:25:25
# File Name: ./parse.py
# Description:
#########################################################################
import numpy

f = open('ww.txt', 'r')
ts = 0
num_ts = 6
data = [[],[],[],[],[],[]]
for l in f:
    new_ts = int(l[:10])
    if ts > 0 and ts+1 < new_ts:
        for i in range(ts+1, new_ts):
            for j in range(num_ts):
                data[j].append(data[j][-1])
    ll = l[11:-2].split(',')
    for j in range(num_ts):
        data[j].append(float(ll[j]))
    if ts == 0:
        print new_ts
    ts = new_ts
print ts
f.close()
numpy.save('humidity.npy', data[0])
numpy.save('tempc.npy', data[2])
numpy.save('pressure.npy', data[4])

